﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="cakesByTag.aspx.vb" Inherits="diy_wc_prototype.cakesByTag" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="gvLeft">
        <h3>
            Quick filter by tag:</h3>
        <br />
        <asp:DropDownList ID="ddl_tags" runat="server" AutoPostBack="True" DataSourceID="ds_tags"
            DataTextField="tag" DataValueField="tag" AppendDataBoundItems="True">
            <asp:ListItem Text="Please select" Value="" />
        </asp:DropDownList>
        <asp:SqlDataSource ID="ds_tags" runat="server" ConnectionString="<%$ ConnectionStrings:diycakeConnectionString %>"
            ProviderName="<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>"
            SelectCommand="SELECT DISTINCT [tag] FROM [tag]"></asp:SqlDataSource>
        <br />
        <br />
        Filtered by:
        <asp:ListView ID="ListView1" runat="server" DataSourceID="ds_tags">
            <ItemTemplate>
                <asp:Label ID="tagLabel" runat="server" Text='<%# Request.QueryString("tag") %>' />
            </ItemTemplate>
        </asp:ListView>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
            AllowSorting="True" GridLines="Horizontal" Width="920px" BorderStyle="None">
            <Columns>
                <asp:ImageField DataImageUrlField="cakeImg1" SortExpression="cakeImg1">
                    <ItemStyle CssClass="profilePic" />
                </asp:ImageField>
                <asp:BoundField DataField="cakeType" HeaderText="Type" SortExpression="cakeType" />
                <asp:BoundField DataField="cakeYr" HeaderText="Year" SortExpression="cakeYr" />
                <asp:TemplateField HeaderText="Difficulty" SortExpression="cakeDifficulty">
                    <ItemTemplate>
                        <%# getDifficulty(Eval("cakeDifficulty"))%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Rating" SortExpression="cakeStar" ItemStyle-CssClass="stars">
                    <ItemTemplate>
                        <%# getStars(Eval("cakeStar"))%></ItemTemplate>
                    <ItemStyle CssClass="stars"></ItemStyle>
                </asp:TemplateField>
                <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="cakeProfile.aspx?ID={0}"
                    Text="More" />
            </Columns>
            <HeaderStyle BackColor="#666666" BorderStyle="None" ForeColor="White" Height="40px"
                HorizontalAlign="Left" />
        </asp:GridView>
          <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString = "<%$ ConnectionStrings:diycakeConnectionString %>"
        ProviderName = "<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>"

               SelectCommand="SELECT DISTINCT ID, cakeImg, cakeYr, cakeDesc, cakeStar, cakeMultiImg, cakeType, cakeTitle, cakeDifficulty, tag FROM cakeTagViewAll WHERE tag=?">
        <SelectParameters>
            <asp:QueryStringParameter Name="?" QueryStringField="tag" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            AllowSorting="True" GridLines="Horizontal" Width="920px" BorderStyle="None" DataSourceID="SqlDataSource3">
            <Columns>
                <asp:ImageField DataImageUrlField="cakeImg1" SortExpression="cakeImg1">
                    <ItemStyle CssClass="profilePic" />
                </asp:ImageField>
                <asp:BoundField DataField="cakeType" HeaderText="Type" SortExpression="cakeType" />
                <asp:BoundField DataField="cakeYr" HeaderText="Year" SortExpression="cakeYr" />
                <asp:TemplateField HeaderText="Difficulty" SortExpression="cakeDifficulty">
                    <ItemTemplate>
                        <%# getDifficulty(Eval("cakeDifficulty"))%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Rating" SortExpression="cakeStar" ItemStyle-CssClass="stars">
                    <ItemTemplate>
                        <%# getStars(Eval("cakeStar"))%></ItemTemplate>
                    <ItemStyle CssClass="stars"></ItemStyle>
                </asp:TemplateField>
                <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="cakeProfile.aspx?ID={0}"
                    Text="More" />
            </Columns>
            <HeaderStyle BackColor="#666666" BorderStyle="None" ForeColor="White" Height="40px"
                HorizontalAlign="Left" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:diycakeConnectionString %>"
            ProviderName="<%$ ConnectionStrings:diycakeConnectionString.ProviderName %>"
            SelectCommand="SELECT * FROM [cake] WHERE ([cakeTag] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="cakeTag" QueryStringField="tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
